package com.sky.mapper.user;

import com.sky.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    @Select("select * from user where openid=#{openid}")
    User selectByOpenId(String openId);

    void save(User user);

    @Select("select * from user where id=#{id}")
    User selectById(Long userId);

    @Delete("delete from user where id = #{id}")
    void deleteById(Long userId);

    Map<String, Long> selectEveryDayIncrementCountByDate(@Param("start") String start,
                                                         @Param("end") String end,
                                                         @Param("dateList") List<String> dateList);

    @Select("select count(*) from user where create_time<concat(#{start},' 00:00:00')")
    Long selectTotalBeforeDate(String start);

    Map<String, Object> selectEveryDayNewUserTotalByDate(@Param("begin") String oldBegin,
                                                         @Param("end") String oldEnd,
                                                         @Param("list") List<String> dateList);
}
